/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ucjava.chat.commserve.tonys.client;
import uc.edu.server.IAdvertisementEngine;
/**
 *
 * @author tony
 */
public class AdvertisementEngineStub implements IAdvertisementEngine
{
    // List of ads to be sent to client:
    private String[] ads = { "Enjoy Legos for Breakfast!",
                "Who Says a Colonoscopy Can't be Fun?",
                "Meet Sanitary Systems Engineers in Your Town!",
                "Adopt a Degree -- Don't Support Diploma Mills!",
                "Ubuntu Unleashed Bible for Dummies -- Now in the Kindle Store",
                "Bobtail Doodads -- Be Free of Facebook at Last!",
                "Visualise Whirled Peas",
                "Replace your Prius' Battery Pack with Cheap AAA's!",
                "Mental Floss -- Keep Your Brain Free of Food Debris",
                "Last Day to Send in Your Dollar!",
                "If a cow laughed real hard, would milk come out her nose?"
                };
    private int adCounter; // which is the next ad to be sent?
    
    // Constructor
    public AdvertisementEngineStub()
    {
        adCounter = 0;
    }
    
    @Override
    public String getAdvertisement()
    {
        if (adCounter < 0 || adCounter >= ads.length)
          {
            return null;
          }
        else
          {
            return ads[adCounter++];
          }
    } // end getAdvertisement()
} // end class AdvertisementEngineStub
